package ObjectFn4;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class test2 {
    public static void main(String[] args) throws ParseException {
        String t1 = "2023-11-11 00:01:18";
        String t2 = "2023-11-11 00:11:18";
        String res1 = "2023-11-11 00:00:00";
        String res2 = "2023-11-11 00:10:00";


        SimpleDateFormat date1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date d1 = date1.parse(t1);
        Date d2 = date1.parse(t2);
        Date resTime1 = date1.parse(res1);
        Date resTime2 = date1.parse(res2);
        if(d1.getTime() >= resTime1.getTime() && d1.getTime()<=resTime2.getTime()){
            System.out.println("d1秒杀成功");
        }
        if(d2.getTime() >= resTime1.getTime() && d2.getTime()<=resTime2.getTime()){
            System.out.println("d2秒杀成功");
        }else{
            System.out.println("d2秒杀失败");
        }
        System.out.println(d1);
        System.out.println(d2);

    }
}
